//package com.example.runable;
//
//import com.example.util.ElasticSearchUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.elasticsearch.common.unit.TimeValue;
//import org.elasticsearch.index.query.BoolQueryBuilder;
//import org.elasticsearch.index.query.MatchAllQueryBuilder;
//import org.elasticsearch.index.query.QueryBuilders;
//import org.elasticsearch.index.query.RangeQueryBuilder;
//import org.elasticsearch.search.builder.SearchSourceBuilder;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.ApplicationArguments;
//import org.springframework.boot.ApplicationRunner;
//import org.springframework.stereotype.Component;
//
//import java.io.IOException;
//import java.util.List;
//import java.util.Map;
//
//@Component
//@Slf4j
//public class EsDemoRunner implements ApplicationRunner {
//    @Autowired
//    ElasticSearchUtils elasticSearchUtils;
//
//    @Override
//    public void run(ApplicationArguments args) throws Exception {
//        method01();
//    }
//
//    private void method01() throws IOException {
////        String index="applog*";
//        String index="applog.ceres.bond.ks-2022.01.05";
//        boolean indexExist = elasticSearchUtils.isIndexExist(index);
//        SearchSourceBuilder query = new SearchSourceBuilder();
//        BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();
//        MatchAllQueryBuilder matchAllQueryBuilder = QueryBuilders.matchAllQuery();
//        RangeQueryBuilder rangeQueryBuilder = QueryBuilders
//                .rangeQuery("postdate")
//                .from("2021-06-01 00:00:00");
//        boolQueryBuilder.must(rangeQueryBuilder);
//        query.query(boolQueryBuilder);
//        query.from(0);
//        query.size(100);
//        query.timeout(new TimeValue(2000));
//
//
//        List<Map<String, Object>> maps = elasticSearchUtils.searchListData(index, query, "appname");
//        System.out.println(maps);
//    }
//}
